package com.example.apiproject.websocket;

import lombok.AllArgsConstructor;
import lombok.Getter;

@Getter
@AllArgsConstructor
public enum CommandType {

    // 建立连接
    CONNECTION(1001),

    ERROR(-1)
    ;


    private final Integer code;

    public static CommandType match(Integer code){
        for (CommandType val: CommandType.values()) {
            if(val.getCode().equals(code)){
                return val;
            }
        }
        return ERROR;
    }


}
